package com.ctshk.sapp.visa.controller;


import com.ctshk.common.annotations.OperationLogAnnotation;
import com.ctshk.common.dto.Result;
import com.ctshk.common.enums.OperationLogModel;
import com.ctshk.common.enums.OperationLogType;
import com.ctshk.rpc.visa.dto.visa.VisaOrderCollectionDTO;
import com.ctshk.rpc.visa.dto.visa.VisaOrderRefundDTO;
import com.ctshk.rpc.visa.req.visa.VisaOrderRefundDetailReq;
import com.ctshk.rpc.visa.req.visa.VisaOrderRefundReq;
import com.ctshk.rpc.visa.req.visa.VisaOrdercollectionReq;
import com.ctshk.rpc.visa.service.IVisaOrderCollectionService;
import com.ctshk.rpc.visa.service.IVisaOrderRefundService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import com.ctshk.common.web.support.BaseController;

import javax.validation.Valid;
import java.util.List;

/**
 * <p>
 * 签证退款记录 前端控制器
 * </p>
 *
 * @author 谢诗宏
 * @since 2021-02-04
 */
@Api(value="退款记录", tags="退款记录")
@RestController
@RequestMapping("/visa-order-refund")
public class VisaOrderRefundController extends BaseController {
    @DubboReference
    private IVisaOrderRefundService iVisaOrderRefundService;

    @ApiOperation(value="退款记录", notes="退款记录(陈雷)")
    @OperationLogAnnotation(operModul = OperationLogModel.VISA, operType = OperationLogType.ADD, operTitle = "退款记录", operDesc = "退款记录")
    @PostMapping("/list")
    public Result<List<VisaOrderRefundDTO>> list(@RequestBody @Valid VisaOrderRefundReq visaOrderRefundReq) {
        return iVisaOrderRefundService.list(visaOrderRefundReq);
    }

    @ApiOperation(value="操作退款", notes="操作退款(陈雷)")
    @OperationLogAnnotation(operModul = OperationLogModel.VISA, operType = OperationLogType.ADD, operTitle = "退款记录", operDesc = "退款记录")
    @PostMapping("/rufund")
    public Result<Long> rufund(@RequestBody @Valid VisaOrderRefundDetailReq visaOrderRefundDetailReq) {
        return iVisaOrderRefundService.rufund(visaOrderRefundDetailReq);
    }

    @ApiOperation(value="删除退款记录", notes="删除退款记录(陈雷)")
    @OperationLogAnnotation(operModul = OperationLogModel.VISA, operType = OperationLogType.ADD, operTitle = "退款记录", operDesc = "退款记录")
    @PostMapping("/delete")
    public Result<Long> delete(@RequestBody @Valid VisaOrderRefundDetailReq visaOrderRefundDetailReq) {
        return iVisaOrderRefundService.delete(visaOrderRefundDetailReq);
    }
}
